package com.sdry.product.prod.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sdry.common.BaseController;
import com.sdry.common.BaseTypeEnum;
import com.sdry.common.TableDataInfo;
import com.sdry.product.prehangingline.entity.PreHangingLine;
import com.sdry.product.prod.entity.ProductWarehousing;
import com.sdry.product.prod.service.ProductWarehousingService;
import com.sdry.system.entity.SysUser;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (生产管理)表控制层
 *
 * @author makejava
 * @since 2020-03-03 16:21:03
 */
@Controller
@RequestMapping("productWarehousing")
public class ProductWarehousingController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private ProductWarehousingService productWarehousingService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    @ResponseBody
    public ProductWarehousing selectOne(Long id) {
        return this.productWarehousingService.queryById(id);
    }

    /**
     * 展示
     * @return
     */
    @RequestMapping(value = "showProductWarehousing")
    public String showProductWarehousing() {
        return "/product/prod/productWarehousing";
    }

    /**
     * 分页查询生产管理
     * @param productWarehousing 生产管理
     * @return TableDataInfo
     */
    @RequestMapping(value = "queryProductWarehousingPage")
    @ResponseBody
    public TableDataInfo queryProductWarehousingPage(ProductWarehousing productWarehousing) {
        logger.info("分页查询生产管理 productWarehousing = {} " + JSONObject.fromObject(productWarehousing));
        List<ProductWarehousing> productWarehousingList = productWarehousingService.queryAllByLimit(productWarehousing);
        Long total = productWarehousingService.queryAllByTotal(productWarehousing);
        return getDataTable(productWarehousingList,total);
    }

}